<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="t" uri="http://tiles.apache.org/tags-tiles"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>


<div class="row-fluid">
    <div class="row-fluid">

        <sf:form method="POST" class="form-horizontal" modelAttribute="usuarioForm" action="save">


            <sf:hidden path="op"/>

            <div class="control-group">
                <label class="control-label" for="organizacaoId">Organização</label>
                <div class="controls">

                    <sf:select cssClass="chzn-select" path="organizacaoId" data-placeholder="Escolha uma Organização...">
                        <sf:option value="0">&nbsp;</sf:option>
                        <c:forEach var="organizacao" items="${organizacoes}">

                            <sf:option value="${organizacao.id}">${organizacao.sigla}</sf:option>
                        </c:forEach>
                    </sf:select>
                    <br/>
                    <sf:errors path="organizacaoId" cssClass="text-error" />
                </div>
            </div>

            <div class="control-group">
                <sf:label cssClass="control-label" path="nome">Nome</sf:label>

                    <div class="controls">
                    <sf:input path="nome" placeholder="Nome" /><br/>
                    <sf:errors path="nome" cssClass="text-error" />

                </div>
            </div>
            <div class="control-group">
                <sf:label cssClass="control-label" path="nomeGuerra">Nome de Guerra</sf:label>

                    <div class="controls">
                    <sf:input path="nomeGuerra" placeholder="Nome de Guerra" /><br/>
                    <sf:errors path="nomeGuerra" cssClass="text-error" />

                </div>
            </div>
            <div class="control-group">
                <sf:label cssClass="control-label" path="posto">Posto</sf:label>

                    <div class="controls">
                    <sf:input path="posto" placeholder="Posto" /><br/>
                    <sf:errors path="posto" cssClass="text-error" />

                </div>
            </div>

            <div class="control-group">
                <sf:label cssClass="control-label" path="telefone">Email</sf:label>

                    <div class="controls">
                    <sf:input path="email" placeholder="Email" /><br/>
                    <sf:errors path="email" cssClass="text-error" />

                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="telefone">Telefone</label>
                <div class="controls">
                    <sf:input path="telefone" placeholder="Telefone" /><br/>
                    <sf:errors path="telefone" cssClass="text-error" />
                </div>
            </div>
                
            <div class="control-group">
                <label class="control-label" for="login">Login</label>
                <div class="controls">
                    <c:if test="${usuarioForm.op == 'NEW'}">
                        <sf:input path="login" placeholder="Login" /><br/>
                    </c:if>
                    <c:if test="${usuarioForm.op == 'EDIT'}">
                        <sf:input readonly="true" path="login" placeholder="Login" ready-only="" /><br/>
                    </c:if>
                    <sf:errors path="login" cssClass="text-error" />
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="senha">Senha</label>
                <div class="controls">
                    <sf:password path="senha" placeholder="Senha" /><br/>
                    <sf:errors path="senha" cssClass="text-error" />
                </div>
            </div>






            <div class="form-actions">

                <button class="btn btn-info" type="submit">
                    <i class="icon-ok bigger-110"></i>
                    Gravar
                </button>



                &nbsp; &nbsp; &nbsp;
                <a class="btn" href="javascript:back()">
                    <i class="icon-undo bigger-110"></i>
                    Voltar
                </a>
            </div>


        </sf:form>

    </div>



    <!--inline scripts related to this page-->

    <script type="text/javascript">


        $(function() {
            $(".chzn-select").chosen();
            $(".chzn-select-deselect").chosen({allow_single_deselect: true});
            $.mask.definitions['~'] = '[+-]';
            $('.input-mask-phone').mask('(99) 9999-9999');
        });
    </script>